package com.cqcvc.service;

import com.cqcvc.mapper.DocsMapper;
import com.cqcvc.pojo.Docs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DocsService {
    @Autowired
    private DocsMapper docsMapper;

    /**
     * 根据id删除记录
     * @param id
     */
    public void del(int id){
        docsMapper.del(id);
    }

    /**
     * 根据id获取当前记录对象
     * @param id
     * @return
     */
    public Docs getById(int id){
        return  docsMapper.getById(id);
    }

    /**
     * 查询用户本人的文档记录
     * @param author
     * @return
     */
    public List<Docs> search(String author){
        return docsMapper.search(author);
    }

    /**
     * 插入数据
     * @param title
     * @param type
     * @param url
     * @param author
     * @return
     */
    public int insert(String title,String type,String url,String author){
        return docsMapper.insert(title, type, url, author);
    }
}
